import uuid


class StrUtil(object):
    @staticmethod
    def generate_uuid():
        """
        生成一个UUID字符串
        """
        return str(uuid.uuid4()).replace("-", "")

    @staticmethod
    def is_empty(s):
        """
        判断字符串是否为空
        """
        return s is None or len(s.strip()) == 0

    @staticmethod
    def is_whitespace(s):
        """
        判断字符串是否由空格组成
        """
        return s.isspace() if s else False

    @staticmethod
    def to_uppercase(s):
        """
        将字符串转换为大写
        """
        return s.upper() if s else s

    @staticmethod
    def to_lowercase(s):
        """
        将字符串转换为小写
        """
        return s.lower() if s else s

    @staticmethod
    def capitalize_first(s):
        """
        将字符串首字母大写
        """
        return s.capitalize() if s else s

    @staticmethod
    def reverse(s):
        """
        反转字符串
        """
        return s[::-1] if s else s
